package com.zp.singleton;

/**
 * @author zhpeng
 * @discription 懒汉式，线程安全（双重检验锁，速度比纯加同步锁快）
 * @created 2021/9/3 14:10
 */
public class Singleton04 {
    private static Singleton04 singleton04;
    private Singleton04(){};
    public static Singleton04 getInstance(){
        if(singleton04 == null){
            synchronized (Singleton04.class){
                if(singleton04 == null){
                    singleton04 = new Singleton04();
                }
            }
        }
        return singleton04;
    }
}
